home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 1 / Cream of the Crop 1.iso / PROGRAM / TTY.ARJ / TTYIO.H < prev    next >
C/C++ Source or Header  |  1992-03-11  |  2KB  |  104 lines

  1. //    Written by Chris Sokol
  2.  
  3. #ifndef TTYIO_H
  4. #define TTYIO_H    1
  5.  
  6. #include <utype.h>
  7.  
  8. #ifdef __cplusplus
  9. extern "C" {
  10. #endif
  11.  
  12. void    TTYInit(void);
  13. void    TTYTerm(void);
  14.  
  15. int    TTYOpen(uint io, uint irq, int ty, uint *rb, uint rl, uint *tb, uint tl);
  16. //        Returns >= 0 if opened, error otherwise
  17.  
  18. int    TTYClose(int h);
  19. //        Returns 0 if closed, error otherwise
  20.  
  21. int    TTYAvail(int h);
  22. //        Returns 1 if event available, 0 if event not available, error otherwise
  23.  
  24. uint    TTYGet(int h);
  25. //        Returns event code (see enums below)
  26.  
  27. int    TTYPut(int h, uint c);
  28. //        Returns 0 if character queued, error otherwise
  29.  
  30. int    TTYDone(int h);
  31. //        Returns 1 if output complete, 0 if transmitting, error otherwise
  32.  
  33. enum
  34. {
  35.     // error values
  36.  
  37.     TTYbadhand    = -1,
  38.     TTYbadio        = -2,
  39.     TTYbadirq    = -3,
  40.     TTYbadtype    = -4,
  41.     TTYnullbuf    = -5,
  42.     TTYquefull    = -6,
  43. };
  44.  
  45. enum
  46. {
  47.     //    possible values for port type (param ty to TTYOpen())
  48.  
  49.     TTYnorm,
  50.     TTYv8at0,
  51.     TTYv8at1,
  52.     TTYv8at2,
  53.     TTYv8at3,
  54.     TTYv8at4,
  55.     TTYv8at5,
  56.     TTYv8at6,
  57.     TTYv8at7,
  58. };
  59.  
  60. enum
  61. {
  62.     // possible values for high byte of TTYGet()
  63.  
  64.     TTYrxchar,                                    // low byte is a received character
  65.     TTYrxlins,                                    // low byte is new line status
  66.     TTYrxmdms,                                    // low byte is new modem status
  67.  
  68.     TTYhndinv    = 0xfe,                        // error: handle is invalid
  69.     TTYnodata    = 0xff                        // error: no data is available
  70. };
  71.  
  72. enum
  73. {
  74.     // possible values for high byte of TTYPut()
  75.     
  76.     TTYtxchar,                                    // low byte is a character to transmit
  77.     TTYtxbaud,                                    // low byte is new baud rate selector
  78.     TTYtxhwfc,                                    // low byte is CTS enable flag
  79.     TTYtxlinc,                                    // low byte is new line control
  80.     TTYtxmdmc,                                    // low byte is new modem control
  81.     TTYtxxofc,                                    // low byte is XON/XOFF enable flag
  82. };
  83.  
  84. enum
  85. {
  86.     // possible low byte values when high byte of TXPut() is TTYtxbaud
  87.  
  88.     TTY300,
  89.     TTY1200,
  90.     TTY2400,
  91.     TTY4800,
  92.     TTY9600,
  93.     TTY19200,
  94.     TTY38400,
  95.     TTY57600,
  96.     TTY115200,
  97. };
  98.  
  99. #ifdef __cplusplus
  100. }
  101. #endif
  102.  
  103. #endif
  104.